package com.sad.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.sad.dao.RecordManager;
import com.sad.model.JsonObject;
import com.sad.model.Orderback;
import com.sad.service.BaseService;
import com.sad.util.G;

@SuppressWarnings({ "rawtypes", "unchecked" })
public class ExpressformService extends BaseService<Orderback> {

	@Override
	public Orderback findById(Map<String, Object> parms) {
		String pageid = StringUtils.defaultString((String) parms.get(G.K.pageid), "expressform");
		String wishid = (String) parms.get("wishid");
		JsonObject jObject = (JsonObject) RecordManager.loadRecord(pageid).get(parms);
		if (jObject != null && jObject.getInfo() != null) {
			List<Orderback> wishs = jObject.getInfo();
			for (Orderback w : wishs) {
				System.out.println(w.getWishId());
				if (w.getWishId().equals(wishid)) {
					return w;
				}
			}
		}

		return null;
	}

}
